<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>clientWidth/Height</title>
		<style>
			#box {
				width: 100px;
				height: 100px;
				padding: 10px;
				border: 30px solid red;
				overflow-y: auto;
			}
		</style>
	</head>
	<body>
		<div id="box">
			Lorem ipsum, dolor sit amet consectetur adipisicing elit. Rerum molestias et repudiandae consequatur sit quod
			omnis, labore eum vero incidunt cumque commodi itaque officiis? Nemo exercitationem repellendus officiis dolorum
			soluta?
		</div>

		<script>
			// 不要从 CSS 中获取 width/height。

			// clientWidth 和 clientHeight 获取元素的宽度和高度（包括内容宽高和padding，不包括边框和滚动条）
			console.log(box.clientWidth) // 103
			console.log(box.clientHeight) // 103
		</script>
	</body>
</html>
